<html xmlns:th="http://www.thymeleaf.org">
<head>
    <!--资源获取-->
    <base th:href="|${#request.getContextPath()}/|">
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="static/lib/html5shiv.js"></script>
    <script type="text/javascript" src="static/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="static/lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <!--[if IE 6]>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--layui-->
    <link rel="stylesheet" type="text/css" href="static/layui/css/layui.css"/>
    <style>
        .layui-form-checkbox span {
            height: 20px;
        }

    </style>
    <script type="text/javascript" src="static/layui/layui.js"></script>
    <title>资讯列表</title>
</head>
<body>
<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i>
    首页
    <span class="c-gray en">&gt;</span>
    记账本
    <span class="c-gray en">&gt;</span>
    添加记账
    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
       href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <label class="layui-form-label">记账标签</label>
        <div class="layui-input-inline" style="width: 56%;">
            <input type="hidden" id="accountId" th:value="${account.accountId}">
            <div  id="tags"  class="xm-select-demo">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">金额</label>
        <div class="layui-input-block">
            <input id="classMoney" type="text" name="title" th:value="${account.classMoney}" lay-verify="number"
                   placeholder="请输入金额" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="static/lib/jquery/1.9.1/jquery.min.js"></script>

<script type="text/javascript" src="static/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/layui/lay/modules/dist/xm-select.js"></script>
<script>
    var cronStrs = "";
    var demo1 = xmSelect.render({
        el: '#tags',
        radio: true,
        clickClose: true,
        prop:{
            name: 'className',
            value: 'className',
        },
        data: [

        ]
    })
    $.ajax({
        url:'acc/selectbqs',
        type:'GET',
        async:false,
        data:{
            "id":$("#accountId").val()
        },success:function (res) {
            demo1.update({
                data:res.data
            })
        }
    })


    //Demo
    layui.use('form', function () {
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function (data) {

            var accountId = $("#accountId").val();
            var userId = [[${session.session_user.uId}]];
            var accountClass = demo1.getValue("valueStr");
            var classRemark = $("#classRemark").val();
            var classMoney = $("#classMoney").val();
            $.ajax({
                url: "acc/addacc",
                type: "POST",
                data: {
                    "accountId": accountId,
                    "uId": userId,
                    "accountClass": accountClass,
                    "classMoney":classMoney
                }, success: function () {
                    console.log("成功")
                }
            })
            return false;
        });

    });
</script>
</body>
</html>
